import request from '@/utils/request'

// 获取已设置的评价人
export function getHaveSettingUsers(params) {
  return request({
    url: `/v1/eavalute/personnel`,
    method: 'GET',
    params
  })
}

// 设置评价人
export function createEvaluateUsers(data) {
  return request({
    url: `/v1/eavalute/personnel`,
    method: 'POST',
    data
  })
}

// 删除评价人
export function deleteEvaluateUsers(params) {
  return request({
    url: `/v1/eavalute/personnel`,
    method: 'DELETE',
    params
  })
}

// 获取评价列表
export function getEvaluateRecords(params) {
  return request({
    url: `/v1/eavalute/record`,
    method: 'GET',
    params
  })
}

// 创建评价
export function createEvaluate(data) {
  return request({
    url: `/v1/eavalute/record`,
    method: 'POST',
    data
  })
}

// 获取待被评价人员
export function getUsersWaitEvaluate() {
  return request({
    url: `/v1/eavalute/personnel/department`,
    method: 'GET'
  })
}

// 获取评价详情
export function getEvaluateDetails(params) {
  return request({
    url: `/v1/eavalute/record/details`,
    method: 'GET',
    params
  })
}

// 新增被评价人
export function addAppraisedPersonnel(data) {
  return request({
    url: `/v1/eavalute/personnel/cover`,
    method: 'POST',
    data
  })
}

// 删除被评价人
export function removeAppraisedPersonnel(params) {
  return request({
    url: `/v1/eavalute/personnel/cover`,
    method: 'DELETE',
    params
  })
}

// 获取被评价人员的评价列表
export function getAppraisedPersonnelResult(params) {
  return request({
    url: `/v1/eavalute/rsults`,
    method: 'GET',
    params
  })
}

// 获取被评价人评价详情
export function getAppraisedPersonnelResultDetails(params) {
  return request({
    url: `/v1/eavalute/results/details`,
    method: 'GET',
    params
  })
}

// 获取统计数据
export function getEvaluateStatistics(params) {
  return request({
    url: `/v1/eavalute/statistics`,
    method: 'GET',
    params,
    header: {
      'company-id': params.company_id
    }
  })
}

// 评价数据导出
export function exportEvaluateData(params) {
  return request({
    url: `/v1/eavalute/xlsx`,
    method: 'GET',
    params
  })
}
